package org.NooLab.randomgraph.components;

 
import org.NooLab.structures.randomgraph.ParticledTextIntf;
import org.NooLab.utilities.CallbackForPrcCompletionIntf;
import org.NooLab.utilities.strings.StringsUtil;


abstract public class TextChunkerAbstract 
											implements 
														TextChunkerIntf,
														CallbackForPrcCompletionIntf{

	
	BasicTextProcessorIntf basicTextProcessor ;
	ParticledTextIntf particledText ;
	
	// simple processing ....................
	// removing special quotation marks, non-ascii stuff
	protected WordCleanerIntf wordcleaner;
	protected TextCleanerIntf textCleaner;
	
	// ......................................
	private int target; 
	
	protected String text = "";
	
	/** the shortest possible sentence OUTSIDE quotations */
	int    minimumLengthAlphaWords = 3;
	/** prevents pseudo-sentences consisting from numbers;
	 * note that dots in nums are excluded anyway */
	double maximumPortionNums = 0.14 ;
	/**  preventing giant sentences */
	int    useCapitalsAlternativelyByWordCount = 40; 
	
	protected StringsUtil strgutil = new StringsUtil();
	
	
	// ========================================================================
	public TextChunkerAbstract(int target) {
		init( null, target);
	}

	public TextChunkerAbstract( BasicTextProcessorIntf basicTextProcessor, int target) {
		init( basicTextProcessor, target);
	}
	
	private void init( BasicTextProcessorIntf basicProcessor, int target ){
		basicTextProcessor = basicProcessor;
		this.target = target;
	}
	// ========================================================================
	
	@Override
	abstract public int perform() ;
	
	@Override
	public void plugParticledTextContainer(ParticledTextIntf particledtext) {
		
		particledText = particledtext;
	}
	

	@Override
	public void setCompletionPercentage(double prcValue) {
		// 
		
	}
	

	@Override
	public void setCallback(CallbackForPrcCompletionIntf callback) {
		
		CallbackForPrcCompletionIntf callbackInstance = callback;
		
		strgutil.setDisplayCompletion(callbackInstance) ;
		 
	}

	
	
	
	public void setWordcleaner(WordCleanerIntf wordcleaner) {
		this.wordcleaner = wordcleaner;
	}

	public void setTextcleaner(TextCleanerIntf textcleaner) {
		this.textCleaner = textcleaner;
	}
 

	
}
